+2000-08-31 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextbtree.c (GtkTextBTree): cache end line,
+ for rapid testing whether an iterator is the end iterator
+ (gtk_text_btree_new): init end line cache
+ (gtk_text_line_is_last): use fast cached line to
+ see if we're the last line.
+ (get_last_line): use cached line here too, should
+ speed up some random unrelated code.
+
2000-08-30 Havoc Pennington <hp@pobox.com>
* gtk/gtkmarshal.list: Add marshallers for changed GtkTextBuffer
+2000-08-31 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextbtree.c (GtkTextBTree): cache end line,
+ for rapid testing whether an iterator is the end iterator
+ (gtk_text_btree_new): init end line cache
+ (gtk_text_line_is_last): use fast cached line to
+ see if we're the last line.
+ (get_last_line): use cached line here too, should
+ speed up some random unrelated code.
+
2000-08-30 Havoc Pennington <hp@pobox.com>
* gtk/gtkmarshal.list: Add marshallers for changed GtkTextBuffer
+2000-08-31 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextbtree.c (GtkTextBTree): cache end line,
+ for rapid testing whether an iterator is the end iterator
+ (gtk_text_btree_new): init end line cache
+ (gtk_text_line_is_last): use fast cached line to
+ see if we're the last line.
+ (get_last_line): use cached line here too, should
+ speed up some random unrelated code.
+
2000-08-30 Havoc Pennington <hp@pobox.com>
* gtk/gtkmarshal.list: Add marshallers for changed GtkTextBuffer
+2000-08-31 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextbtree.c (GtkTextBTree): cache end line,
+ for rapid testing whether an iterator is the end iterator
+ (gtk_text_btree_new): init end line cache
+ (gtk_text_line_is_last): use fast cached line to
+ see if we're the last line.
+ (get_last_line): use cached line here too, should
+ speed up some random unrelated code.
+
2000-08-30 Havoc Pennington <hp@pobox.com>
* gtk/gtkmarshal.list: Add marshallers for changed GtkTextBuffer
+2000-08-31 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextbtree.c (GtkTextBTree): cache end line,
+ for rapid testing whether an iterator is the end iterator
+ (gtk_text_btree_new): init end line cache
+ (gtk_text_line_is_last): use fast cached line to
+ see if we're the last line.
+ (get_last_line): use cached line here too, should
+ speed up some random unrelated code.
+
2000-08-30 Havoc Pennington <hp@pobox.com>
* gtk/gtkmarshal.list: Add marshallers for changed GtkTextBuffer
+2000-08-31 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextbtree.c (GtkTextBTree): cache end line,
+ for rapid testing whether an iterator is the end iterator
+ (gtk_text_btree_new): init end line cache
+ (gtk_text_line_is_last): use fast cached line to
+ see if we're the last line.
+ (get_last_line): use cached line here too, should
+ speed up some random unrelated code.
+
2000-08-30 Havoc Pennington <hp@pobox.com>
* gtk/gtkmarshal.list: Add marshallers for changed GtkTextBuffer
+2000-08-31 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextbtree.c (GtkTextBTree): cache end line,
+ for rapid testing whether an iterator is the end iterator
+ (gtk_text_btree_new): init end line cache
+ (gtk_text_line_is_last): use fast cached line to
+ see if we're the last line.
+ (get_last_line): use cached line here too, should
+ speed up some random unrelated code.
+
2000-08-30 Havoc Pennington <hp@pobox.com>
* gtk/gtkmarshal.list: Add marshallers for changed GtkTextBuffer
pointed-to segment and segment offset.
*/
guint segments_changed_stamp;
+
+ GtkTextLine *end_iter_line;
+
+ guint end_iter_line_stamp;
};
in random memory garbage. */
tree->chars_changed_stamp = 49;
tree->segments_changed_stamp = 243;
+
+ tree->end_iter_line_stamp = tree->chars_changed_stamp - 1;
+ tree->end_iter_line = NULL;
gtk_object_ref(GTK_OBJECT(tree->table));
gtk_object_sink(GTK_OBJECT(tree->table));
* no way to add ld without also validating the node, which would
* be improper at this point.
*/
+ /* This assertion does actually fail sometimes, must
+ fix before stable release -hp */
g_assert (ld);
ld->width = MAX (deleted_width, ld->width);
}
gboolean
-gtk_text_line_is_last (GtkTextLine *line)
+gtk_text_line_is_last (GtkTextLine *line,
+ GtkTextBTree *tree)
{
- GtkTextBTreeNode *node;
-
- if (line->next != NULL)
- return FALSE;
- else
- {
- node = line->parent;
- while (node != NULL && node->next == NULL)
- node = node->parent;
-
- return node == NULL;
- }
+ return line == get_last_line (tree);
}
GtkTextLine*
static GtkTextLine*
get_last_line(GtkTextBTree *tree)
{
- gint n_lines;
- GtkTextLine *line;
- gint real_line;
-
- n_lines = gtk_text_btree_line_count(tree);
+ if (tree->end_iter_line_stamp != tree->chars_changed_stamp)
+ {
+ gint n_lines;
+ GtkTextLine *line;
+ gint real_line;
- g_assert(n_lines >= 1); /* num_lines doesn't return bogus last line. */
+ n_lines = gtk_text_btree_line_count(tree);
+
+ g_assert(n_lines >= 1); /* num_lines doesn't return bogus last line. */
+
+ line = gtk_text_btree_get_line(tree, n_lines, &real_line);
- line = gtk_text_btree_get_line(tree, n_lines, &real_line);
+ tree->end_iter_line_stamp = tree->chars_changed_stamp;
+ tree->end_iter_line = line;
+ }
- return line;
+ return tree->end_iter_line;
}
/*
GtkTextBTree *tree,
gint byte_in_line,
GtkTextTag *tag);
-gboolean gtk_text_line_is_last (GtkTextLine *line);
+gboolean gtk_text_line_is_last (GtkTextLine *line,
+ GtkTextBTree *tree);
GtkTextLine * gtk_text_line_next (GtkTextLine *line);
GtkTextLine * gtk_text_line_previous (GtkTextLine *line);
void gtk_text_line_add_data (GtkTextLine *line,
*
* Returns TRUE if @iter is the end iterator, i.e. one past the last
* dereferenceable iterator in the buffer. gtk_text_iter_is_last() is
- * the second most efficient way to check whether an iterator is the
- * end iterator.
+ * the most efficient way to check whether an iterator is the end
+ * iterator.
*
* Return value: whether @iter is the end iterator
**/
check_invariants(iter);
- return gtk_text_line_is_last(real->line);
+ return gtk_text_line_is_last(real->line, real->tree);
}
/**